package com.schedule.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.schedule.entity.Event;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface EventMapper extends BaseMapper<Event> {
    /**
     * 查询该用户所有事件，返回随机列表
     * @param id 用户id
     * @return
     */
    @Select("select * from event where event.user_id=#{id} order by rand()")
    List<Event> orderByRand(Long id);
}
